package org.x4444.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@IdClass(org.x4444.entity.OrderDetailPK2.class)
@Entity
@Table(name="Z_DETAIL2")
public class OrderDetail2 {
		
	Integer orderId;

	Integer productId;
	
	Order order;
	
	Product product;

	public OrderDetail2(Integer orderId, Integer productId) {
		super();
		this.orderId = orderId;
		this.productId = productId;
	}

	public OrderDetail2() {

	}

	@Id
	@Column(name="ORDER_ID")
	public Integer getOrderId() {
		return orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}

	@Id
	@Column(name="PRODUCT_ID")
	public Integer getProductId() {
		return productId;
	}

	public void setProductId(Integer productId) {
		this.productId = productId;
	}
	
	@ManyToOne
	@JoinColumn(name="ORDER_ID", referencedColumnName="ID")
	public Order getOrder() {
		return order;
	}
	
	public void setOrder(Order order) {
		this.order = order;
	}
	
	@ManyToOne
	@JoinColumn(name="PRODUCT_ID")
	public Product getProduct() {
		return product;
	}
	
	public void setProduct(Product product) {
		this.product = product;
	}
}
